//
//  Size+Ext.swift
//  TimMusic
//
//  Created by nkl on 2024/10/23.
//

import Foundation

class TimSize {
    static let smallSize: CGSize = .init(width: 155, height: 155)

    static let mediumSize: CGSize = .init(width: 329, height: 155)

    static let largeSize: CGSize = .init(width: 329, height: 345)

    static var scaleMediumSize: CGSize {
        let width = UIScreen.kScreenWidth
        // 中号组件，一排2个
        let w = width - 16 * 2
        let h = (w / 329 * 155).rounded(.up)
        let realSize = CGSize(width: w, height: h)
        return realSize
    }

    static var scaleSmallSize: CGSize {
        let width = UIScreen.kScreenWidth - 32
        // 中号组件，一排2个
        let w = (width - 16) / 2
        let h = w
        let realSize = CGSize(width: w, height: h)
        return realSize
    }

    static func scaleSmallSize(colum: Int, spacing: CGFloat = 16, horizonInset: CGFloat = 32) -> CGSize {
        let width = UIScreen.kScreenWidth - spacing * (CGFloat(colum) - 1.0) - horizonInset
        let w = width / CGFloat(colum)
        let h = w
        let realSize = CGSize(width: w, height: h)
        return realSize
    }

    static var scaleSpecialMediumSize: CGSize {
        let contentW = UIScreen.kScreenWidth - 16 * 2
        let w = ((contentW - 16) / 2).rounded(.down)
        let h = (w / 329 * 155).rounded(.up)
        let realSize = CGSize(width: w, height: h)
        return realSize
    }
}
